
//获取url中指定的参数
export const GetUrlParam = (url,paraName) => {
    let arrObj = url.split("?");
    if (arrObj.length > 1) {
        let arrPara = arrObj[1].split("&");
        let arr;
        for (let i = 0; i < arrPara.length; i++) {
            arr = arrPara[i].split("=");
            if (arr !== null && arr[0] === paraName) {
                return arr[1];
            }
        }
        return "";
    }else {
        return "";
    }
}

// TODO 确认各个应用的跳转链接
// 打开应用连接
export const openAppLink = (obj, linkid, linkType) => {
    // 新地址
    if (Number(linkType) === 37) {
      window.openFullWindowHaveBar
        ? window.openFullWindowHaveBar(
        `/spa/document/index.jsp?id=${linkid}&router=1#/main/document/detail`
        )
        : window.open(
            `/spa/document/index.jsp?id=${linkid}&router=1#/main/document/detail`
          );
    } else {
      if (linkType === "37")
      window.open(
          "/spa/document/index.jsp?id=" +linkid+ "&router=1#/main/document/detail"
        );
      else if (linkType === "task")
      window.open(
          "/proj/process/ViewTask.jsp?taskrecordid=" +
          linkid +
          "&linkType=" +
          linkType +
          "&linkid=" +
          linkid
        );
      else if (linkType === "18")
      window.open(
          "/spa/crm/static/index.html#/main/crm/customerView?customerId=" +
          linkid +
          "&linkType=" +
          linkType +
          "&linkid=" +
          linkid
        );
      else if (linkType === "152")
      window.open(
          "/spa/workflow/static4form/index.html#/main/workflow/req?requestid=" +
          linkid +
          "&linkType=" +
          linkType +
          "&linkid=" +
          linkid
        );
      else if (linkType === "135")
      window.open(
          "/spa/prj/index.html#/main/prj/projectCard?prjid=" +
          linkid +
          "&linkType=" +
          linkType +
          "&linkid=" +
          linkid
        );
      else if (linkType === "prjtsk")
      window.open(
          "/spa/prj/index.html#/main/prj/taskCard?taskid=" +
          linkid +
          "&linkType=" +
          linkType +
          "&linkid=" +
          linkid
        );
        else if(linkType=="workplan"){
            window.open(
              "/spa/workplan/static/index.html#/main/wp/workPlanCreateSingle?moduleid=blog&workid=" +
              linkid+
              "&linkType=" +
              linkType +
              "&linkid=" +
              linkid
            );
          }
    }
    return false;
  };
  